/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package controllers;

import entities.Personalpackage;
import java.util.List;
import javax.ejb.Stateless;
import javax.faces.context.FacesContext;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author selam
 */
@Stateless
public class PersonalpackageFacade extends AbstractFacade<Personalpackage> {
    @PersistenceContext(unitName = "TravelDreamProjectPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public PersonalpackageFacade() {
        super(Personalpackage.class);
    }

    public List<Personalpackage> findByID(String id) {
    String jql="SELECT c FROM Personalpackage c where (c.userId.userId=:id)";        
        Query q = getEntityManager().createQuery(jql);
        q.setParameter("id", Integer.parseInt(id));
        return q.getResultList();        
    }
  
  
    
}
